s = input("Введите три слова:").split()
numbers = int(''.join(['0' if word == 'zero' else '1' if word == 'one' else '2' if word == 'two' else '3' if word == 'three' else '4' if word == 'four' else '5' if word == 'five' else '6' if word == 'six' else '7' if word == 'seven' else '8' if word == 'eight' else '9' for word in s]))
if len(s) != 3 or s == numbers:
    print("Wrong input")
else:
    print(numbers)
def isSimple(n):
    i = 2
    while i < n // 2 +1:
        if n % 2 == 0:
            return False
        i += 1
    return True
a = 1
while True:
  if isSimple(numbers - a):
    print(numbers - a)
    break
  if isSimple(numbers) + a:
    print(numbers + a)
    break
  a += 1
